
var ser = [];
var data1 = [];
var data2 = [];

function goods_change(value){
	 

	

	$.ajax( {
		type : "get",
		url : "/jeesite/a/glspxx/testFxGlspxx/ajaxglspxx",
		data: {"guanxi":value},
		dataType:"json",
		success : function(list) {
		for(var i = 0 ; i < list[0].length ; i++){
			
			data1[i] = [list[0][i].kprq,list[0][i].hjje];
		}
        for(var i = 0 ; i < list[1].length ; i++){
			
			data2[i] = [list[1][i].kprq,list[1][i].hjje];
		}
		
        ser.push({"name":list[0][0].spmc,"type":'scatter',
            "large": true,"data":data1});
        ser.push({"name":list[1][0].spmc,"type":'scatter',
            "large": true,"data":data2});
//        alert(list.length);
//        alert(list[0].length);
//        alert(list[1].length);
//        alert(list[0][0].spmc);
//        alert(list[0][0].hjje);
//        alert(list[0][0].kprq);      
		draw_graph(list);
		},
		
        error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert(9876543210);
} 
	});
	
 }
	
	


function draw_graph(list){
	
	$("#contentTable").hide();
	$(".pagination").hide();
	$("#glspxx").show();
	
    require.config({
        paths: {
            echarts: '/jeesite/static/dist'
        }
    });     
	
    require(
            [
                'echarts',
                'echarts/chart/scatter'
            ],
            function (ec) {
                var myChart = ec.init(document.getElementById('glspxx')); 
                var option = {
                	    tooltip : {
                	        trigger: 'axis',
                	        showDelay : 0,
                	        axisPointer:{
                	            show: true,
                	            type : 'cross',
                	            lineStyle: {
                	                type : 'dashed',
                	                width : 1
                	            }
                	        }
                	    },
                	    legend: {
                	        data:['牛奶','麦片']
                	    },
                	    toolbox: {
                	        show : true,
                	        feature : {
                	            mark : {show: true},
                	            dataZoom : {show: true},
                	            dataView : {show: true, readOnly: false},
                	            restore : {show: true},
                	            saveAsImage : {show: true}
                	        }
                	    },
                	    xAxis : [
                	        {   
                	        	data:'牛奶',
                	            type : 'value',
                	            scale:true
                	        }
                	    ],
                	    yAxis : [
                	        {
                	        	data:'麦片',
                	            type : 'value',
                	            scale:true
                	        }
                	    ],
                	    series : ser
                	    	//[
//                	        {
//                	            name:'牛奶_麦片',
//                	            type:'scatter',
//                	            large: true,
//                	            data: [[12,3],[11,4]]
//                	        }
//                	    ]
                	    
                	};
                	                    

                    myChart.setOption(option); 
                // 为echarts对象加载数据 
            }
        );
	
	
	


    
    
}